package 笔试.同城58;

import java.util.Scanner;

/**
 * @author:谢君臣
 * @Date:2021/9/12-15:33
 * @version:1.0
 * @function:
 */
public class Main04 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt(),count=0;
        int [] res = new int[37];
        for (int i = 1; i <= n; i++) {
            int temp = i,index = 0;
            while (temp>0){
                index += temp%10;
                temp = temp/10;
            }
            int sum = res[index]+1;
            res[index] = sum;
            count = Math.max(count,sum);
        }
        int result = 0;
        for (int i = 0; i < res.length; i++) {
            if (res[i]==count) result++;
        }
        System.out.println(result);
    }
}
